
import java.util.Scanner;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author XuanHung
 */
public class clsPhuongTrinhBacNhat {
    private float m_fA;
    private float m_fB;
    
    public void setA(float _fA){
        m_fA = _fA;
    }
    public float getA(){
        return m_fA;
    }
    public void setB(float _fB){
        m_fB = _fB;
    }
    public float getB(){
        return m_fB;
    }
    public clsPhuongTrinhBacNhat(){
        m_fA = 0;
        m_fB = 0;
    }
    public clsPhuongTrinhBacNhat(double _dbA, double _dbB){
        m_fA = (float)_dbA;
        m_fB = (float)_dbB;
    }
    public clsPhuongTrinhBacNhat(clsPhuongTrinhBacNhat pt){
        this.m_fA = pt.m_fA;
        this.m_fB = pt.m_fB;
    }
    public void GiaiPhuongTrinh(){
         if((this.m_fA != 0)||(this.m_fB == 0)){        
            System.out.print("phuong trinh vo nghiem");
         }
        else
         {
             if(this.m_fA != 0){
                System.out.print("Phuong trinh co nghiem X = -"+  (this.m_fB/this.m_fA));
             }
             else{
                 System.out.print("Phuong trinh co vo so nghiem");
             }            
         }
    }
    public void NhapPhuongTrinhBacNhat(){
       Scanner sn = new Scanner(System.in);
       System.out.println("Nhap he so A:");
       this.m_fA = Float.parseFloat(sn.nextLine());
       System.out.println("Nhap he so B:");
       this.m_fB = Float.parseFloat(sn.nextLine());
    }
}
